
package extremefx.unitTest {
	import flash.events.Event;

	import extremefx.GlobalStage;

	import flash.text.TextFormat;
	import flash.text.TextField;

	/**
	 * @author Administrator
	 */
	public final class Debug {
		private static var _inited:Boolean;		private static var _tf:TextField;
		private static function _init():void {
			if (_inited) return;
			
			var tf:TextField = _tf = new TextField();
			var tfmt:TextFormat = new TextFormat("arial unicode ms", 14, 0);
			GlobalStage.stage.addEventListener(Event.RESIZE, _resizeStage);
			GlobalStage.stage.addChild(tf);
			tf.x = 0;
			tf.y = 0;
			tf.width = GlobalStage.stage.stageWidth;
			tf.height = GlobalStage.stage.stageHeight;
			tf.defaultTextFormat = tfmt;
			_inited = true;
		}
		
		private static function _resizeStage(event:Event):void {
			_tf.width = GlobalStage.stage.stageWidth;
			_tf.height = GlobalStage.stage.stageHeight;
		}
		
		public static function show(pObject:Object):void {
			_init();
			_tf.appendText(String(pObject));
			_tf.appendText("\n");
		}
		
		public static function showFull(pObject:Object):void {
			_init();
			_tf.appendText(Trace.obj(pObject));
			_tf.appendText("\n");
		}
	}
}
